package com.thinkgem.jeesite.modules.app.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.thinkgem.jeesite.modules.cms.entity.Article;
import com.thinkgem.jeesite.modules.cms.entity.ArticleData;
import com.thinkgem.jeesite.modules.cms.entity.Category;
import com.thinkgem.jeesite.modules.sys.entity.User;

import java.util.Date;

/**
 * Created by xiaguoqiang on 16/6/1.
 */
public class AArticle {
    private String id;		// 编号
    private String title;	// 标题
    private String link;	// 外部链接
    private String image;	// 文章图片
    private String keywords;// 关键字
    private String description;// 描述、摘要
    private Integer hits;	// 点击数
    private String content;	// 内容
//    private String copyfrom;// 来源
//    private String relation;// 相关文章

    private Date updateDate;	// 开始时间

    private String userName;
    private String userId;
    public AArticle(Article article) {
        this.id = article.getId();
        this.title = article.getTitle();
        this.link = article.getLink();
        this.image = article.getImage();
        this.keywords = article.getKeywords();
        this.description = article.getDescription();
        this.hits = article.getHits();
//        this.content = article.getArticleData().getContent();
//        this.copyfrom = article.getArticleData().getCopyfrom();
//        this.relation = article.getArticleData().getRelation();
        this.updateDate = article.getUpdateDate();
        if(article.getUser() != null){
            this.userName = article.getUser().getName();
            this.userId = article.getUser().getId();
        }

    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getKeywords() {
        return keywords;
    }

    public void setKeywords(String keywords) {
        this.keywords = keywords;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Integer getHits() {
        return hits;
    }

    public void setHits(Integer hits) {
        this.hits = hits;
    }

    public String getContent(){ return content; }

    public void setContent(String content){ this.content = content; }

    @JsonFormat(pattern = "yyyy-MM-dd")
    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }
}
